home *** CD-ROM | disk | FTP | other *** search
Wrap
import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.util.Random; import javax.microedition.lcdui.Alert; import javax.microedition.lcdui.Canvas; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Font; import javax.microedition.lcdui.Graphics; import javax.microedition.lcdui.Image; import javax.microedition.rms.RecordStore; class Screen extends Canvas implements CommandListener { public static Random rnd = new Random(); public static int x_res; public static int y_res; public static int x_cen; public static int y_cen; // $FF: renamed from: lt int public static int field_0; // $FF: renamed from: rt int public static int field_1; // $FF: renamed from: lb int public static int field_2; // $FF: renamed from: rb int public static int field_3; public static int hct; public static int hcb; public static int scroll_y; static String[] names = new String[]{"Kintaro-Kun", "Reiko-Chan", "Mach Hachi"}; static int[] hscore = new int[]{500, 450, 400, 350, 300, 250, 200, 150, 100, 50}; static String[] hscoren = new String[]{"AAA", "BBB", "CCC", "DDD", "EEE", "FFF", "GGG", "HHH", "III", "JJJ"}; public boolean loading = true; public Image dbuffer; // $FF: renamed from: up boolean public boolean field_4; public boolean down; public boolean left; public boolean right; public int game_mode; public int game_timer; public int lvl; public int score; public int life; public int active_items; public int coll_x1; public int coll_y1; public int coll_x2; public int coll_y2; public int hero_y; public int spring_frame; public int spring_pause; public int last_spring_pause; public int say; public int selected; public int goal; // $FF: renamed from: xs int public int field_5; // $FF: renamed from: ys int public int field_6; public int hero_status; public int dir; public int items_left; public int item_pause; public int[] item_x; public int[] item_y; public int[] item_dx; public int[] item_dy; public int[] item_status; public int[] item_type; public int[] y_size; // $FF: renamed from: gr javax.microedition.lcdui.Graphics public Graphics field_7; public Sprite logo; public Sprite texts; // $FF: renamed from: bg Sprite public Sprite field_8; public Sprite face; public Sprite item; public Sprite spring; public Sprite saygfx; public Sprite textbox; public Sprite[] hero; public Sprite[] shield; // $FF: renamed from: fn javax.microedition.lcdui.Font Font field_9; Font bold; Font fixed; private Deflex deflex; private Engine eng; private Command exitCommand = new Command("Exit", 7, 10); private Command helpCommand = new Command("Help", 1, 20); private Command aboutCommand = new Command("About", 1, 30); private Command restartCommand = new Command("Restart", 1, 40); private Command startCommand = new Command("Start", 1, 50); private Command soundCommand = new Command("Sound: ON", 1, 55); private Command vibraCommand = new Command("Vibrator: ON", 1, 56); private String strHelp = "Eres un estudiante de artes marciales en mitad del examen final para Maestro Ninja. Ya has pasado varias pruebas probando tu fortaleza física y mental. Ahora es el momento de demostrar que te mereces el título de Maestro Ninja. Es esta prueba final tu misión es la de detener todos los objetos que te lancen con tu escudo Ninja. Los corazones indican tu estado de salud. El juego termina cuando no te quedan corazones. Puedes elegir entre tres candidatos para el desafío.\n\nUsa las teclas numéricas para colocar tu escudo correctamente: 1 (arriba izqda), 4 (centro izqda), 7 (abajo izqda), 3 (arriba dcha), 6 (centro dcha), 9 (abajo dcha)."; private Sound sound; private int progress = 0; public Screen(Deflex var1) { this.deflex = var1; x_res = ((Canvas)this).getWidth(); y_res = ((Canvas)this).getHeight(); x_cen = x_res >> 1; y_cen = y_res >> 1; y_res = 80; y_cen = 40; this.logo = new Sprite(2, "/logo"); this.field_9 = Font.getFont(64, 0, 8); this.bold = Font.getFont(64, 1, 8); this.fixed = Font.getFont(32, 1, 8); this.dbuffer = Image.createImage(x_res, y_res); ((Canvas)this).repaint(); ((Canvas)this).serviceRepaints(); this.eng = new Engine(this); this.eng.start(); this.Mode(21, 40); } static int rand() { return rnd.nextInt() & 524287; } public int Get_Item() { for(int var1 = 0; var1 < 8; ++var1) { if (this.item_status[var1] < 1) { return var1; } } return -1; } public void addprogress() { if (this.progress < 25) { ++this.progress; } ((Canvas)this).repaint(); ((Canvas)this).serviceRepaints(); Thread.yield(); } public void commandAction(Command var1, Displayable var2) { if (var1 == this.exitCommand) { this.eng.stop(); this.deflex.destroyApp(false); this.deflex.notifyDestroyed(); } else if (var1 == this.aboutCommand) { Alert var3 = new Alert("Ninja Master"); var3.setTimeout(-2); var3.setString("Version 1.2.1t Copyright 2002 Mr. Goodliving Ltd."); Display.getDisplay(this.deflex).setCurrent(var3); } else if (var1 == this.helpCommand) { Alert var4 = new Alert("Ninja Master"); var4.setTimeout(-2); var4.setString(this.strHelp); Display.getDisplay(this.deflex).setCurrent(var4); } else if (var1 == this.restartCommand) { ((Displayable)this).removeCommand(this.restartCommand); ((Displayable)this).addCommand(this.startCommand); this.Mode(20, 50); } else if (var1 == this.startCommand) { this.New_Game(); } else if (var1 == this.soundCommand) { this.setSound(!this.sound.useSound); } else if (var1 == this.vibraCommand) { this.setVibra(!this.sound.useVibrator); } } public void loadShit() { System.gc(); this.texts = new Sprite(2, "/text"); this.addprogress(); this.field_8 = new Sprite(1, "/bg"); this.addprogress(); this.face = new Sprite(3, "/face"); this.addprogress(); this.hero = new Sprite[3]; this.addprogress(); this.textbox = new Sprite(1, "/txtbox"); this.addprogress(); this.hero[0] = new Sprite(7, "/hero0"); this.addprogress(); this.hero[1] = new Sprite(7, "/hero1"); this.addprogress(); this.hero[2] = new Sprite(7, "/hero2"); this.addprogress(); this.shield = new Sprite[3]; this.addprogress(); this.shield[0] = new Sprite(2, "/shield0"); this.addprogress(); this.shield[1] = new Sprite(2, "/shield1"); this.addprogress(); this.shield[2] = new Sprite(2, "/shield2"); this.addprogress(); this.item = new Sprite(5, "/item"); this.addprogress(); this.spring = new Sprite(3, "/spring"); this.addprogress(); this.saygfx = new Sprite(1, "/say"); this.addprogress(); hct = 17; hcb = 33; field_0 = 20; this.addprogress(); field_1 = 24; field_2 = 36; field_3 = 40; this.addprogress(); this.item_x = new int[8]; this.item_y = new int[8]; this.item_dx = new int[8]; this.addprogress(); this.item_dy = new int[8]; this.item_status = new int[8]; this.item_type = new int[8]; this.y_size = new int[3]; this.addprogress(); this.y_size[0] = this.hero[0].id[6].getHeight(); this.y_size[1] = this.hero[1].id[6].getHeight(); this.y_size[2] = this.hero[2].id[6].getHeight(); this.addprogress(); this.sound = new Sound(true, true); this.sound.newSound("S1-T120-L32-c3-c2"); this.addprogress(); this.sound.newSound("S1-T180-L16-e3-@-e3-@-L8-e3-g3-a3-h3-c4"); this.sound.newSound("S1-T120-L32-e3"); this.addprogress(); this.sound.newSound("S1-T120-L32-e4"); this.sound.newSound("S1-T120-L32-c3-e4-c4-c3-L16-g3"); this.addprogress(); this.sound.newSound("S1-T140-L32-e3-e2-d3-d2-c3-L16-c2"); this.sound.newSound("S1-T120-L16-c3-@-c3-g2-L8-c2"); this.addprogress(); this.sound.newSound("S1-T180-L4-A2-g2-d2-L8-a2-g2-L4-d2-f2-L2-g2-L4-d2-L8-c2-d2-L4-c2-L8-c2-d2-L4-f2-f2-L8-g2-A2-L4-g2-@-c3-L8-A2-c3-L4-D3-c3-A2-L8-c3-D3-L2-c3-L4-g2-L8-f2-g2-L4-A2-g2-d2-F2-L2-g2"); this.sound.newSound("S1-T180-L16-c3-g3-@-c3-L8-c4"); this.addprogress(); try { this.loadScores(); } catch (Exception var2) { System.out.println(((Throwable)var2).toString()); } this.addprogress(); ((Displayable)this).addCommand(this.exitCommand); ((Displayable)this).addCommand(this.helpCommand); ((Displayable)this).addCommand(this.aboutCommand); ((Displayable)this).addCommand(this.startCommand); ((Displayable)this).addCommand(this.soundCommand); ((Displayable)this).addCommand(this.vibraCommand); ((Displayable)this).setCommandListener(this); this.addprogress(); this.loading = false; } public void Mode(int var1, int var2) { this.game_mode = var1; this.game_timer = var2; } public void New_Game() { this.selected = 0; this.lvl = 0; this.score = 0; this.New_Level(); this.Mode(0, 10); this.life = 3; ((Displayable)this).removeCommand(this.startCommand); ((Displayable)this).addCommand(this.restartCommand); } public void New_Level() { this.goal = (this.lvl + 1) * 10; this.items_left = this.goal; this.item_pause = 10 + rand() % (15 - (this.lvl << 1)) + rand() % (30 - (this.lvl << 1)); this.hero_status = 0; this.dir = 0; this.hero_y = y_res - 5; this.say = 0; for(int var1 = 0; var1 < 8; ++var1) { this.item_status[var1] = 0; } } public void Game_Over() { ((Displayable)this).addCommand(this.startCommand); ((Displayable)this).removeCommand(this.restartCommand); this.Mode(22, 50); this.checkHiScore(); } public void Select_Paint() { int var1; if (this.game_mode == 2) { var1 = this.game_timer / 10; } else { var1 = 0; } this.face.P(this.field_7, this.selected, x_cen, 15, hct); this.field_7.setFont(this.bold); this.field_7.setColor(0); this.field_5 = this.bold.stringWidth("Select Character"); this.field_7.fillRect(x_cen - (this.field_5 >> 1), 1, this.field_5 + 1, this.field_6); this.field_5 = this.bold.stringWidth(names[this.selected]); this.field_7.fillRect(x_cen - (this.field_5 >> 1), 16 + this.face.y_size, this.field_5 + 1, this.field_6); this.field_5 = this.bold.stringWidth("10"); this.field_7.fillRect(5 - (this.field_5 >> 1), y_cen - 4, this.field_5 + 1, this.field_6); this.field_7.fillRect(x_res - 5 - (this.field_5 >> 1), y_cen - 4, this.field_5 + 1, this.field_6); this.field_7.setColor(16777215); this.field_7.drawString("Select Character", x_cen, 1, hct); this.field_7.drawString(names[this.selected], x_cen, 16 + this.face.y_size, hct); this.field_7.drawString("" + var1, 5, y_cen - 4, hct); this.field_7.drawString("" + var1, x_res - 5, y_cen - 4, hct); } public void Item_Logic() { for(int var1 = 0; var1 < 8; ++var1) { if (this.item_status[var1] > 0) { ++this.active_items; if (this.item_status[var1] != 2) { int[] var10000 = this.item_y; var10000[var1] += this.item_dy[var1]; int var10002 = this.item_dy[var1]++; if (this.item_y[var1] > y_res - 5) { var10002 = this.item_dy[var1]--; this.item_dy[var1] = -this.item_dy[var1]; } } int[] var2 = this.item_x; var2[var1] += this.item_dx[var1]; if (this.item_dx[var1] < 0) { if (this.item_x[var1] < -8) { this.item_status[var1] = 0; } } else if (this.item_x[var1] > x_res) { this.item_status[var1] = 0; } if (this.game_mode == 7) { this.Collision(var1); } } } } public void Collision(int var1) { int var2 = (this.hero[this.selected].x_size >> 1) - 2; int var3 = 0; int var4 = 0; this.field_7.setColor(16777215); if (this.item_x[var1] > x_cen - var2 && this.item_x[var1] < x_cen + var2) { label30: switch (this.selected) { case 0: if (this.hero_status == 3) { var3 = y_res - 5 - 24; } else { var3 = y_res - 5 - 34; } var4 = y_res - 5; break; case 1: switch (this.hero_status) { case 1: var3 = y_res - 5 - 36; var4 = y_res - 24; break label30; case 3: var3 = y_res - 5 - 16; var4 = y_res - 5; break label30; default: var3 = y_res - 5 - 34; var4 = y_res - 5; break label30; } case 2: var3 = y_res - 5 - 35; var4 = y_res - 5; } if (this.item_y[var1] > var3 && this.item_y[var1] < var4) { this.item_status[var1] = 0; if (this.item_type[var1] == 0) { if (this.life < 3) { this.sound.playSound(8); ++this.life; } } else { this.Hit(); } } } } public void Hit() { if (this.life > 1) { this.sound.playSound(5); this.sound.triggerVibrator(150); --this.life; this.say = 15; } else { this.Die(); } } public void Item_Paint() { for(int var1 = 0; var1 < 8; ++var1) { if (this.item_status[var1] > 0) { this.item.P(this.field_7, this.item_type[var1], this.item_x[var1], this.item_y[var1], hcb); } } } public void Hero_Paint() { String var1 = ""; if (this.score < 10) { var1 = "000" + this.score; } else if (this.score < 100) { var1 = "00" + this.score; } else if (this.score < 1000) { var1 = "0" + this.score; } else { var1 = "" + this.score; } this.field_7.drawString(var1, x_res, 0, field_1); for(int var2 = 0; var2 < this.life; ++var2) { this.item.P(this.field_7, 0, 1 + var2 * 9, 1, field_0); } int var3 = this.selected; switch (this.hero_status) { case 0: this.hero[var3].P(this.field_7, 0, x_cen, this.hero_y, hcb); break; case 1: this.hero[var3].P(this.field_7, 1 + this.dir, x_cen, this.hero_y, hcb); break; case 2: this.hero[var3].P(this.field_7, 3 + this.dir, x_cen, this.hero_y, hcb); break; case 3: this.hero[var3].P(this.field_7, 5 + this.dir, x_cen, this.hero_y, hcb); } int var4 = 0; int var5 = 0; byte var6 = 0; switch (this.hero_status) { case 1: if (this.dir == 0) { var6 = 0; var4 = x_cen + 13; var5 = y_res - 32; } else { var6 = 1; var4 = x_cen - 13; var5 = y_res - 32; } break; case 2: if (this.dir == 0) { var6 = 0; var4 = x_cen + 13; var5 = y_res - 22; } else { var6 = 1; var4 = x_cen - 13; var5 = y_res - 22; } break; case 3: if (this.dir == 0) { var6 = 0; var4 = x_cen + 13; var5 = y_res - 10; } else { var6 = 1; var4 = x_cen - 13; var5 = y_res - 10; } } if (this.hero_status > 0 && this.hero_status < 11) { this.shield[var3].P(this.field_7, var6, var4, var5, hcb); this.Deflect(var4, var5 - 14, var5 + 1); } } public void Deflect(int var1, int var2, int var3) { for(int var4 = 0; var4 < 8; ++var4) { if (this.item_status[var4] > 0 && this.item_status[var4] != 3 && var1 > this.item_x[var4] - 4 && var1 < this.item_x[var4] + 4 && (this.item_y[var4] > var2 && this.item_y[var4] < var3 || this.item_y[var4] - 4 > var2 && this.item_y[var4] - 4 < var3)) { this.sound.playSound(0); this.sound.triggerVibrator(75); this.score += this.lvl + 1; this.item_status[var4] = 3; int[] var10000 = this.item_dx; var10000[var4] *= -3; int var10002 = this.item_dy[var4]--; } } } public void paint(Graphics var1) { this.field_7 = this.dbuffer.getGraphics(); this.field_7.setClip(0, 0, x_res, y_res); this.field_8.P(this.field_7, 0, 0, 0, field_0); this.field_7.setFont(this.field_9); this.field_7.setColor(16777215); if (!this.loading) { this.field_6 = this.bold.getHeight(); this.active_items = 0; this.coll_x1 = this.coll_y1 = this.coll_x2 = this.coll_y2 = 0; switch (this.game_mode) { case 0: this.field_7.setColor(0); this.logo.P(this.field_7, 0, x_cen, 3, hct); this.field_7.fillRect(x_res / 10 * this.game_timer, 0, x_res, y_res); if (this.game_timer < 1) { this.Mode(1, 10); } break; case 1: this.Select_Paint(); this.field_7.setColor(0); this.field_7.fillRect(x_res - x_res / 10 * this.game_timer, 0, x_res, y_res); if (this.game_timer < 1) { this.Mode(2, 110); } break; case 2: this.Select_Paint(); if (this.game_timer < 1) { this.sound.playSound(4); this.Mode(3, 10); } break; case 3: this.Select_Paint(); this.field_7.setColor(0); this.field_7.fillRect(0, y_res / -10 * this.game_timer, x_res, y_res); if (this.game_timer < 1) { this.Mode(4, 10); } break; case 4: this.Hero_Paint(); this.field_7.setColor(0); this.field_7.fillRect(0, y_res - y_res / 10 * this.game_timer, x_res, y_res); if (this.game_timer < 1) { this.sound.playSound(4); this.Mode(5, 30); } break; case 5: this.Hero_Paint(); this.field_7.drawImage(this.textbox.Get_Image(0), x_cen, y_cen - 8, 3); this.field_7.setColor(0); this.field_5 = this.bold.stringWidth("Level " + (this.lvl + 1)); this.field_7.drawString("Level " + (this.lvl + 1), x_cen, y_cen - 20, hct); if (this.game_timer < 1) { this.sound.playSound(4); this.Mode(6, 30); } break; case 6: this.Hero_Paint(); this.field_7.drawImage(this.textbox.Get_Image(0), x_cen, y_cen - 8, 3); this.field_7.setColor(0); this.field_5 = this.bold.stringWidth("Level " + (this.lvl + 1)); this.field_5 = this.bold.stringWidth("Deflect " + this.goal + " items!"); this.field_7.drawString("Level " + (this.lvl + 1), x_cen, y_cen - 20, hct); this.field_7.drawString("Deflect " + this.goal + " items!", x_cen, y_cen - 10, hct); if (this.game_timer < 1) { this.sound.triggerVibrator(100); this.Mode(7, 0); } break; case 7: this.Hero_Paint(); this.Item_Paint(); this.Item_Logic(); if (this.say > 0) { this.saygfx.P(this.field_7, 0, x_cen, y_res - 40, hcb); this.field_7.setColor(0); --this.say; } this.field_7.setColor(16777215); if (this.items_left > 0) { --this.item_pause; if (this.item_pause < 1) { --this.items_left; this.item_pause = 10 - (this.lvl << 2) + rand() % (15 - (this.lvl >> 1)) + rand() % (25 - (this.lvl << 2)); if (this.item_pause < 5) { this.item_pause = 5; } int var4 = this.Get_Item(); if (var4 != -1) { this.sound.playSound(3); this.item_status[var4] = 1; int var5 = rand() % 2; if (var5 == 0) { if (rand() % (this.lvl + 1) > 0) { this.item_dx[var4] = 2; } else { this.item_dx[var4] = 1; } this.item_x[var4] = -8; } else { if (rand() % (this.lvl + 1) > 0) { this.item_dx[var4] = -2; } else { this.item_dx[var4] = -1; } this.item_x[var4] = x_res; } this.item_type[var4] = rand() % 4 + 1; if (rand() % 100 < 2) { this.item_type[var4] = 0; } var5 = rand() % 10; this.item_dy[var4] = rand() % 5; this.item_y[var4] = y_res - 20 - rand() % 20; if (var5 <= 2) { this.item_status[var4] = 2; int[] var10000 = this.item_dx; var10000[var4] *= 2; switch (rand() % 3) { case 1: this.item_y[var4] = y_res - 21; break; case 2: this.item_y[var4] = y_res - 32; break; default: this.item_y[var4] = y_res - 10; } } } } } else { if (this.active_items < 1) { this.sound.playSound(4); } this.Mode(8, 30); } if (this.left) { this.dir = 1; this.hero_status = 2; } if (this.right) { this.dir = 0; this.hero_status = 2; } if (this.field_4) { this.hero_status = 1; } if (this.down) { this.hero_status = 3; } break; case 8: this.say = 0; this.Hero_Paint(); this.Item_Paint(); this.Item_Logic(); this.field_7.setColor(0); this.field_5 = this.bold.stringWidth("Level Clear!"); this.field_7.fillRect(x_cen - (this.field_5 >> 1), y_cen - 20, this.field_5, this.field_6); this.field_7.setColor(16777215); this.field_7.drawString("Level Clear!", x_cen, y_cen - 20, hct); if (this.game_timer < 1) { ++this.lvl; this.New_Level(); this.Mode(9, 10); this.sound.playSound(4); } break; case 9: this.Hero_Paint(); this.Item_Paint(); this.Item_Logic(); this.field_7.setColor(0); this.field_7.fillRect(x_res / 10 * this.game_timer, 0, x_res, y_res); if (this.game_timer < 1) { this.Mode(10, 10); } break; case 10: this.Hero_Paint(); this.field_7.setColor(0); this.field_7.fillRect(0, y_res - x_res / 10 * this.game_timer, x_res, y_res); if (this.game_timer < 1) { this.Mode(5, 30); } break; case 11: this.Hero_Paint(); this.Item_Paint(); this.spring.P(this.field_7, this.spring_frame, x_cen, y_res - 4, hcb); if (this.spring_pause > 0 && this.game_timer < 16) { --this.spring_pause; } else { if (this.spring_frame == 1) { this.spring_frame = 2; } else { this.spring_frame = 1; } if (this.game_timer < 16) { this.spring_pause = this.last_spring_pause + 1; ++this.last_spring_pause; } } this.hero_y -= 10; if (this.game_timer < 1) { this.sound.playSound(6); this.Mode(15, 50); } case 12: case 13: case 14: case 16: case 17: case 18: default: break; case 15: this.Hero_Paint(); this.spring.P(this.field_7, this.spring_frame, x_cen, y_res - 4, hcb); this.texts.P(this.field_7, 0, x_cen, y_cen - 15, hct); if (this.game_timer < 1) { this.Mode(21, 40); this.checkHiScore(); ((Displayable)this).addCommand(this.startCommand); ((Displayable)this).removeCommand(this.restartCommand); } break; case 19: int var2 = this.texts.y_size + 2; this.field_7.setColor(16777215); this.field_7.fillRect(0, 0, x_res, y_res); this.field_7.setColor(0); this.texts.P(this.field_7, 1, x_cen, 2, hct); this.field_7.setClip(0, var2, x_res, y_res - var2); this.field_7.setFont(this.fixed); for(int var3 = 0; var3 < 10; ++var3) { this.field_7.drawString("" + hscoren[var3], 10, var2 - scroll_y, field_0); this.field_7.drawString("" + hscore[var3], x_res - 10, var2 - scroll_y, field_1); var2 += 8; } if (this.game_timer % 1 == 0 && this.game_timer < 40 && var2 - scroll_y > y_res - 5) { ++scroll_y; } if (this.game_timer < 1) { this.Mode(20, 50); } break; case 20: this.logo.P(this.field_7, 0, x_cen, 3, hct); this.field_7.setColor(0); scroll_y = 0; if (this.game_timer < 1) { this.Mode(19, 50); } break; case 21: this.logo.P(this.field_7, 0, x_cen, 3, hct); this.field_7.setColor(0); scroll_y = 0; this.Mode(20, 50); this.sound.playSound(7); } if (this.game_timer > 0) { --this.game_timer; } } else { System.out.println("REPAINT"); this.field_7.setColor(16777215); this.field_7.fillRect(0, 0, x_res, y_res); this.field_7.drawImage(this.logo.Get_Image(1), x_cen, y_cen - 7, 3); this.field_7.setColor(0); this.field_7.fillRect(x_cen - 27, y_cen + 13 + 4 + 5, 54, 10); this.field_7.setColor(16777215); this.field_7.fillRect(x_cen - 26, y_cen + 14 + 4 + 5, 52, 8); this.field_7.setColor(0); this.field_7.fillRect(x_cen - 25, y_cen + 15 + 4 + 5, this.progress * 50 / 25, 6); } var1.drawImage(this.dbuffer, 0, 0, 0); } public void Die() { this.Mode(11, 20); this.spring_frame = 0; this.spring_pause = 0; this.last_spring_pause = 0; this.hero_y = y_res - 5; this.hero_status = 0; this.sound.playSound(1); this.sound.triggerVibrator(200); } protected void setName(String var1) { for(int var2 = 0; var2 < hscore.length; ++var2) { if (hscore[var2] <= this.score) { for(int var3 = hscore.length - 1; var3 > var2; --var3) { hscore[var3] = hscore[var3 - 1]; hscoren[var3] = hscoren[var3 - 1]; } hscoren[var2] = var1; hscore[var2] = this.score; try { this.saveScores(); } catch (Exception var5) { System.out.println(((Throwable)var5).toString()); } return; } } } protected void keyReleased(int var1) { try { switch (((Canvas)this).getGameAction(var1)) { case 1: this.field_4 = false; break; case 2: this.left = false; case 3: case 4: default: break; case 5: this.right = false; break; case 6: this.down = false; } } catch (Exception var4) { } try { switch (var1) { case 49: this.left = false; this.field_4 = false; break; case 50: this.field_4 = false; break; case 51: this.right = false; this.field_4 = false; break; case 52: this.left = false; case 53: default: break; case 54: this.right = false; break; case 55: this.left = false; this.down = false; break; case 56: this.down = false; break; case 57: this.right = false; this.down = false; } } catch (Exception var3) { } } protected void keyPressed(int var1) { try { switch (((Canvas)this).getGameAction(var1)) { case 1: this.field_4 = true; break; case 2: this.left = true; case 3: case 4: case 7: default: break; case 5: this.right = true; break; case 6: this.down = true; break; case 8: if (this.game_mode == 2) { this.Mode(3, 10); } } } catch (Exception var4) { } try { switch (var1) { case 49: this.left = true; this.field_4 = true; break; case 50: this.field_4 = true; break; case 51: this.right = true; this.field_4 = true; break; case 52: this.left = true; case 53: default: break; case 54: this.right = true; break; case 55: this.left = true; this.down = true; break; case 56: this.down = true; break; case 57: this.right = true; this.down = true; } } catch (Exception var3) { } if (this.game_mode == 2) { if (this.left) { this.sound.playSound(0); --this.selected; if (this.selected < 0) { this.selected = 2; } } if (this.right) { this.sound.playSound(0); ++this.selected; if (this.selected > 2) { this.selected = 0; } } } else if (this.game_mode != 20 && this.game_mode != 19) { if (this.game_mode == 21) { this.Mode(20, 50); } } else { this.sound.stopSound(7); this.New_Game(); } } private void setSound(boolean var1) { this.sound.useSound = var1; if (var1) { ((Displayable)this).removeCommand(this.soundCommand); this.soundCommand = new Command("Sound: ON", 1, 55); ((Displayable)this).addCommand(this.soundCommand); } else { ((Displayable)this).removeCommand(this.soundCommand); this.soundCommand = new Command("Sound: OFF", 1, 55); ((Displayable)this).addCommand(this.soundCommand); } } private void setVibra(boolean var1) { this.sound.useVibrator = var1; if (var1) { ((Displayable)this).removeCommand(this.vibraCommand); this.vibraCommand = new Command("Vibrator: ON", 1, 56); ((Displayable)this).addCommand(this.vibraCommand); } else { ((Displayable)this).removeCommand(this.vibraCommand); this.vibraCommand = new Command("Vibrator: OFF", 1, 56); ((Displayable)this).addCommand(this.vibraCommand); } } private void saveScores() throws Exception { Object var1 = null; RecordStore var6 = RecordStore.openRecordStore("Deflex", true); ByteArrayOutputStream var2 = new ByteArrayOutputStream(); DataOutputStream var3 = new DataOutputStream(var2); for(int var4 = 0; var4 < hscore.length; ++var4) { var3.writeUTF(hscoren[var4]); var3.writeInt(hscore[var4]); } byte[] var5 = var2.toByteArray(); if (var6.getNumRecords() == 1) { var6.setRecord(1, var5, 0, var5.length); } else { var6.addRecord(var5, 0, var5.length); } var6.closeRecordStore(); } private void loadScores() throws Exception { Object var1 = null; RecordStore var6 = RecordStore.openRecordStore("Deflex", false); byte[] var2 = var6.getRecord(1); ByteArrayInputStream var3 = new ByteArrayInputStream(var2); DataInputStream var4 = new DataInputStream(var3); for(int var5 = 0; var5 < hscore.length; ++var5) { hscoren[var5] = var4.readUTF(); hscore[var5] = var4.readInt(); } var6.closeRecordStore(); } private void checkHiScore() { for(int var1 = 0; var1 < hscore.length; ++var1) { if (hscore[var1] <= this.score) { this.deflex.getName(); this.Mode(19, 50); } } } }